<template>
    <view>
        <u-grid
                :border="false"
                col="3"
        >
            <u-grid-item
                    v-for="(listItem,listIndex) in list"
                    :key="listIndex"
					@click="click(listIndex+1)"
            >
                <u-icon
                        :customStyle="{paddingTop:20+'rpx'}"
                        :name="listItem.name"
                        :size="22"
                ></u-icon>
                <text class="grid-text">{{listItem.title}}</text>
            </u-grid-item>
        </u-grid>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                list: [
					{
					    name: 'tags',
					    title: '首页'
					},
					{
                    name: 'plus-circle',
                    title: '发布房源'
                    },
                    {
                        name: 'edit-pen',
                        title: '我的房源'
                    },
                    {
                        name: 'setting',
                        title: '设置信息'
                    },
                    {
                        name: 'info',
                        title: '用户信息'
                    },
                    {
                        name: 'info-circle',
                        title: '关于'
                    },
                ],
            }
        },
        methods: {
            click(index) {
				switch(index){
					case 1:
					uni.switchTab({
						url:'/pages/home/home'
					}); 
					break;
					case 2:
					uni.navigateTo({
						url:'/pages/addhouse/addhouse'
					}); 
					break;
					case 3:
					uni.navigateTo({
						url:'/pages/myhouse/myhouse'
					}); 
					break;
					case 4:
					uni.navigateTo({
						url:'/pages/edituser/edituser'
					}); 
					break;
					case 5:
					uni.switchTab({
						url:'/pages/user/user',
					}); 
					break;
					case 6:
					uni.navigateTo({
						url:'/pages/about/about',
					}); 
					break;
				}
               uni.showToast({
               	title:`点击了第${index}个`,
				icon:"success"
               })
            }
        }
    }
</script>

<style lang="scss">
    .grid-text {
        font-size: 14px;
        color: #909399;
        padding: 10rpx 0 20rpx 0rpx;
        /* #ifndef APP-PLUS */
        box-sizing: border-box;
        /* #endif */
    }
</style>
